// com/tidu/disruptor/handler/ProgressUpdateEventHandler.java
package com.tidu.disruptor.handler;

import com.lmax.disruptor.EventHandler;
import com.tidu.disruptor.event.DataSyncEvent;
import com.tidu.strategy.sync.SyncStrategy;
import lombok.extern.slf4j.Slf4j;

@Slf4j
public class ProgressUpdateEventHandler implements EventHandler<DataSyncEvent> {
    
    private final SyncStrategy syncStrategy;

    public ProgressUpdateEventHandler(SyncStrategy syncStrategy) {
        this.syncStrategy = syncStrategy;
    }

    @Override
    public void onEvent(DataSyncEvent event, long sequence, boolean endOfBatch) throws Exception {
        String progress = syncStrategy.getProgress();
        log.info("当前进度: {}", progress);
    }
}
